#ifndef GEOMETRYDATA_H
#define GEOMETRYDATA_H

#include <QVector>
#include "datastructures.h"
#include <map>
class GeometryData
{
public:

    enum DataType {TRIANGLES, POINTS, CONTOURS, INVALID};

    GeometryData();

    Point *addPoint(double x, double y,double param);
    Triangle *addTriangle(int p1, int p2, int p3, int param = 0);

    Contour * startContour(double param);

    void triangulateContours(const std::string &algo);
    void sharpTriangulation(const std::string &algo);

    void allocPoints(int c) { points.reserve(c+1); }
    void allocTriangles(int c) { triangles.reserve(c+1); }
    void addEdge(Point *p1, Point *p2, Triangle *t);

    Edge * findEdge(Point *p1, Point *p2);

    DataType type() { return data_type; }

    void clear();
    void updateIndeces();

    void autoBound();

    std::vector <Point *> points;
    std::vector <Triangle *> triangles;
    std::vector <Contour *> contours;

    std::vector <Edge *> edges;
    std::map <Point *, std::map <Point *, Edge *> > edges_map;


    bool contour_started;
    int min_param;
    int max_param;
    DataType data_type;

private:

};
#endif // GEOMETRYDATA_H
